/*
* @package Nokia Places Plugin
* @title Colorbox hooks to media button
* @author Nikolai Tihhomirov
*/
jQuery( document ).ready( function(){
	//Live monitor for <a class="placesApi"> click
	jQuery('a.placesApi').live('click', colorbox_click );
	
	//click handler
	function colorbox_click(){
		//href to core api
		var base_url = document.URL.replace(/([\w:\/.]*)(?:\/wp-|\/\?)[\w\W]*/g,'$1');
		var href = base_url+'/wp-content/plugins/nokia-places-plugin/tinymce/page/index.php';
		//initalize colorbox
		jQuery.colorbox({iframe:true, title:"Add a place", href:href, innerWidth:310, innerHeight:50, scrolling:false});
	}
	
});
